package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.LowCodeActionSettingModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.LowCodeActionSettingDao;
import com.xbongbong.pro.domain.entity.LowCodeActionSettingEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:20
 */
@Service("lowCodeActionSettingModel")
public class LowCodeActionSettingModelImpl implements LowCodeActionSettingModel {

    @Resource
    private LowCodeActionSettingDao lowCodeActionSettingDao;

    @Override
    public Integer insert(LowCodeActionSettingEntity entity) throws XbbException {
        long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return lowCodeActionSettingDao.insert(entity);
    }

    @Override
    public Integer update(LowCodeActionSettingEntity entity) throws XbbException {
        long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return lowCodeActionSettingDao.update(entity);
    }

    @Override
    public List<LowCodeActionSettingEntity> findEntitys(Map<String, Object> param) {
        return lowCodeActionSettingDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return lowCodeActionSettingDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer deleteBatch(List<Long> deleteList, String corpid) {
        return lowCodeActionSettingDao.deleteBatch(deleteList, corpid);
    }

    @Override
    public Integer addBatch(List<LowCodeActionSettingEntity> addList) {
        return lowCodeActionSettingDao.insertBatch(addList);
    }

    @Override
    public Integer updateBatch(List<LowCodeActionSettingEntity> updateList, String corpid) {
        return lowCodeActionSettingDao.updateBatch(updateList, corpid);
    }

    @Override
    public Integer deleteByFormId(Long formId, String corpid, Integer businessType) {
        return lowCodeActionSettingDao.deleteByFormId(formId, corpid, businessType);
    }
}
